<?php
namespace App\Dao;

use App\Api\Utils;
class WeekCountTable extends \Lavender\Dao\Table
{
	protected $database = "hangqing_count";
	protected $table = "week_count";
	
	public static function get_last_week()
	{
		$items = self::instance()->get(null,['week'],[],"week desc",0,1);
		if(isset($items[0]) && isset($items[0]['week']))
		{
			return $items[0]['week'];
		}
		return false;
	}
	
	public static function get_last_day_data()
	{
		$week =self::get_last_week();
		if($week)
		{
			$items = self::instance()->get(null,[],['week'=>$week,'state'=>1]);
			return Utils::column_to_key("cid",$items);
		}
		return [];		
	}
}

?>